package exception;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class homework {
    public static void main(String[] args) throws IOException {
//        FileOutputStream fos=new FileOutputStream("txt1.txt");
//        OutputStreamWriter osw=new OutputStreamWriter(fos);
//        BufferedWriter bw=new BufferedWriter(osw);
//        PrintWriter pw=new PrintWriter(bw,true);
//        pw.println("mjh");
//        pw.println("马嘉豪");
//        pw.close();


//        FileInputStream fis=new FileInputStream("txt1.txt");
//        InputStreamReader isr=new InputStreamReader(fis, StandardCharsets.UTF_8);
//        BufferedReader br=new BufferedReader(isr);
//        String line;
//        while((line=br.readLine())!=null){
//            System.out.println(line);
//        }
//        br.close();


//        String name=null;
//        String line ="";
//        System.out.println("开始");
//        try{
//            System.out.println(line.charAt(0));
//            System.out.println(name.length());
//        }catch (NullPointerException e){
//            System.out.println("越界问题已处理");
//        }catch (Exception e){
//            System.out.println("反正有问题");
//        }
//        System.out.println("结束");


//        System.out.println("程序开始");
//        try (FileInputStream fis = new FileInputStream("./q/w/txt1.txt");) {
//            fis.read();
//            return;
//        } catch (IOException e) {
//            System.out.println("处理了Io问题");
//        } finally {
//            System.out.println("执行finally");
//        }
//        System.out.println("程序结束");

//        Student stu=new Student();
//        stu.setAge(20);
//        stu.setName("马嘉豪嗯");
//        System.out.println(stu.getAge()+""+stu.getName());

//        Student stu=new Student();
//        System.out.println("开始执行");
//        try{
//            stu.setAge(20);
//            stu.setName("马嘉豪en");
//            System.out.println(stu.getAge());
//            System.out.println(stu.getName());
//        }catch (RuntimeException e){
//            System.out.println("年龄格式不对");
//        }catch (Exception a){
//            System.out.println("名字格式不对");
//        }
//        System.out.println("执行结束");


//        int age=18;
//        String name="mjh";
//        Student zs=new Student(age,name);
//        FileOutputStream fos=new FileOutputStream("xie.txt");
//        ObjectOutputStream oos=new ObjectOutputStream(fos);
//        oos.writeObject(zs);
//        System.out.println("写入完毕");
//        oos.close();






    }
}
